<?php
/**
 * Created by PhpStorm.
 * User: 35083
 * Date: 2019/7/16
 * Time: 16:36
 */

namespace app\task\controller;

/**
 * 系统任务执行函数
 * Class Runsystemtask
 * @package app\task\controller
 */
class Runsystemtask
{

    public function task($key, $param)
    {
        if (empty($param)) {
            return 1;
        }
        if(empty($param['task_fun']))
        {
            return 2;
        }
        $tempArray = parseNamespacePath($param['task_fun']);
        if (empty($tempArray)) {
            return 3;
        }
        $modeString = $tempArray[0];
        $funString = $tempArray[1];

        $model = new $modeString();
        $result = $model->$funString($param['task_param']);
        return $result;
    }



}